package com.wilmer.consultants_order.service.impl;

import java.util.List;
import com.wilmer.common.utils.DateUtils;
import com.wilmer.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wilmer.consultants_order.mapper.BankConsultantsOrderMapper;
import com.wilmer.consultants_order.domain.BankConsultantsOrder;
import com.wilmer.consultants_order.service.IBankConsultantsOrderService;

/**
 * 顾问订单Service业务层处理
 * 
 * @author hans
 * @date 2024-04-01
 */
@Service
public class BankConsultantsOrderServiceImpl implements IBankConsultantsOrderService 
{
    @Autowired
    private BankConsultantsOrderMapper bankConsultantsOrderMapper;

    /**
     * 查询顾问订单
     * 
     * @param id 顾问订单主键
     * @return 顾问订单
     */
    @Override
    public BankConsultantsOrder selectBankConsultantsOrderById(Long id)
    {
        return bankConsultantsOrderMapper.selectBankConsultantsOrderById(id);
    }

    /**
     * 查询顾问订单列表
     * 
     * @param bankConsultantsOrder 顾问订单
     * @return 顾问订单
     */
    @Override
    public List<BankConsultantsOrder> selectBankConsultantsOrderList(BankConsultantsOrder bankConsultantsOrder)
    {
        Long userId = SecurityUtils.getUserId();
        bankConsultantsOrder.setUserId(userId);
        bankConsultantsOrder.setPay(1);
        return bankConsultantsOrderMapper.selectBankConsultantsOrderList(bankConsultantsOrder);
    }

    /**
     * 新增顾问订单
     * 
     * @param bankConsultantsOrder 顾问订单
     * @return 结果
     */
    @Override
    public int insertBankConsultantsOrder(BankConsultantsOrder bankConsultantsOrder)
    {
        bankConsultantsOrder.setCreateTime(DateUtils.getNowDate());
        return bankConsultantsOrderMapper.insertBankConsultantsOrder(bankConsultantsOrder);
    }

    /**
     * 修改顾问订单
     * 
     * @param bankConsultantsOrder 顾问订单
     * @return 结果
     */
    @Override
    public int updateBankConsultantsOrder(BankConsultantsOrder bankConsultantsOrder)
    {
        bankConsultantsOrder.setUpdateTime(DateUtils.getNowDate());
        return bankConsultantsOrderMapper.updateBankConsultantsOrder(bankConsultantsOrder);
    }

    /**
     * 批量删除顾问订单
     * 
     * @param ids 需要删除的顾问订单主键
     * @return 结果
     */
    @Override
    public int deleteBankConsultantsOrderByIds(Long[] ids)
    {
        return bankConsultantsOrderMapper.deleteBankConsultantsOrderByIds(ids);
    }

    /**
     * 删除顾问订单信息
     * 
     * @param id 顾问订单主键
     * @return 结果
     */
    @Override
    public int deleteBankConsultantsOrderById(Long id)
    {
        return bankConsultantsOrderMapper.deleteBankConsultantsOrderById(id);
    }

    @Override
    public int updateOrder(String orderNum) {
        return bankConsultantsOrderMapper.updateOrder(orderNum);
    }
}
